package com.jyj.fxkj;

import java.util.Arrays;

public class Client {
    public final static String ADD_SYMBOL = "+";
    public final static String SUB_SYMBOL = "-";
    public static void main(String[] argv) {
        int a = Integer.parseInt(argv[0]);
        String symbol = argv[1];
        int b = Integer.parseInt(argv[2]);
        System.out.println("输入的参数:" + Arrays.toString(argv));

        Context context = null;
        if(symbol.equals(ADD_SYMBOL)) {
            context = new Context(new AddStrategy());
        } else if(symbol.equals(SUB_SYMBOL)) {
            context = new Context(new SubStrategy());
        } else {

        }

        System.out.println("运算结果为:" + a + symbol + b + "=" + context.exec(a,b,symbol));
    }
}
